<?php

class SubcategoriasView extends Subcategorias{

	public function listar($arr){
		$total = count($arr);
		for($i = 0;$i < $total;$i++){
			echo '<tr>';
				echo '<td width="30%">',$arr[$i]['nome_sub'],'</td>';
				echo '<td width="20%">',$arr[$i]['nome_cat'],'</td>';
				echo '<td width="20%" align="center" onclick="javascript:editar(',$arr[$i]['idsubcategorias'],',\'subcategorias\');" class="tabelaB"><img src="images/app-edit-icon.png" width="20" align="absmiddle" /> Editar</td>';
				echo '<td width="20%" id="editar" align="center" onclick="javascript:excluir(',$arr[$i]['idsubcategorias'],',\'Subcategorias\');" class="tabelaB"><img src="images/app-delete-icon.png" width="20" align="absmiddle" /> Excluir</td>';
			echo '</tr>';
	    }
	}
	public function visualizar($arr){
		$total = count($arr);
		if($total == 0){
			echo '<center>Sem cadastrados</center>';
		}else{
			for($j = 0;$j < $total;$j++){

			}
		}
	}
	public function select($arr){
		$total = count($arr);
		echo '<option value = "0">Selecione</option>';
		for($i = 0;$i < $total;$i++){
			if($t != $arr[$i]['idcategorias']){
				echo '<optgroup label="',$arr[$i]['nome_cat'],'">';
				$t = $arr[$i]['idcategorias'];
			}
			echo '<option value="',$arr[$i]['idsubcategorias'],'">',$arr[$i]['nome_sub'],'</option>';
	    }
	}
	public function menu($arr){
		$total = count($arr);
		for($i = 0;$i < $total;$i++){
			if($t != $arr[$i]['idcategorias']){
				echo '<h3>',$arr[$i]['nome_cat'],'</h3>';
				$t = $arr[$i]['idcategorias'];
			}
			echo '<b>&bull;&nbsp;<a href="grid.php?s=',$arr[$i]['idsubcategorias'],'">',$arr[$i]['nome_sub'],'</a></b><br />';
		}
		echo '<br /><br />';
	}
}
?>